import { defineConfig } from 'vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import vue from '@vitejs/plugin-vue'
import path from 'path'


// https://vitejs.dev/config/
export default defineConfig({
    publicPath: "./",
    plugins: [
        vue(),
        AutoImport({
            resolvers: [ElementPlusResolver()],
            imports: ['vue', 'vue-router'] //自动导入vue和vue-router相关函数
        }),
        Components({
            resolvers: [ElementPlusResolver()],
        }),
    ],
    //跨域
    // server: {
    //     proxy: {
    //         '/api': {
    //             target: 'http://192.168.43.8:9101',
    //             changeOrigin: true,
    //             rewrite: (path) => path.replace(/^\/api/, '')
    //         }
    //     }
    // }
}
)
